package cz.matasek.dbLogger.exception;

import java.sql.SQLException;

/**
 * Thrown to indicate that a database error has occured.
 *
 * @author Luboš Matásek
 */
public class DatabaseErrorException extends DbLoggerRuntimeException {

    /**
     * Error message displayed when no rows are returned by a query.
     */
    public static final String MESSAGE_NO_ROWS_RETURNED = "No rows returned by query";
    /**
     * Serial version UID.
     */
    private static final long serialVersionUID = 6767182432546853752L;

    /**
     * Creates a new <code>DatabaseErrorException</code> with a message
     * containing error code and message from the database.
     *
     * @param ex SQLException object
     */
    public DatabaseErrorException(SQLException ex) {
        super(ex.getMessage());
    }

    /**
     * Creates a new <code>DatabaseErrorException</code> with a specified
     * message.
     *
     * @param message error message
     */
    public DatabaseErrorException(String message) {
        super(message);
    }
}
